<%- include header%>
<%- include show%>
<script>
	$(function(){
			var winH = $(window).height();
			var i=2;
	
			$(window).scroll(function () { 
				var pageH=$("body").height();
				var scrollT = $(window).scrollTop();
				var aa = (pageH-winH-scrollT)/winH;	
				if(aa<0.02){
					surl=window.location.href;
				$.ajax({
						type:"GET",
						data:{page:i},
						contentType:'application/json',
						url:surl,
						success:function(data){
						if(data.posts.length>0){
							data.posts.forEach(function(post,index){

						
							var str="<div class=\"product\"><div class=\"boss hidden\">"+post.boss+"</div><div class=\"pid hidden\">"+post.pid+"</div><div class=\"row\"><div class=\"col-xs-12\"><ul class=\"breadcrumb\"><li><a class=\"brand\" href=\"/shop/"+post.boss+"/fbrand/"+post.fbrand+"\">"+post.fbrand+"</a></li><li><a class=\"brand\" href=\"/shop/"+post.boss+"/fbrand/"+post.fbrand+"/mbrand/"+post.mbrand+"\">"+post.mbrand+"</a></li><li><a class=\"brand\" href=\"/shop/"+post.boss+"/fbrand/"+post.fbrand+"/mbrand/"+post.mbrand+"/lbrand/"+post.lbrand+"\">"+post.lbrand+"</a></li></ul></div></div><div class=\"row\"><div class=\"col-xs-7\"><h4 ><a href=\"/p/"+post.pid+"\" class=\"pname\">"+post.name+"</a></h4><strong>¥：</strong><a class=\"price inline\">"+post.price+"</a><h6 class=\"desp\">"+post.desp+"</h6><a class=\"sold btn btn-sm btn-danger\">已售:"+post.sold+"件</a><button class=\"add btn btn-sm btn-info\"><i class=\"fa fa-shopping-cart\"></i>Buy!</button></div><div class=\"col-xs-5\"><img src="+post.pic+" class=\"pic img-responsive\" /></div></div><div class=\"row\"><div class=\"col-xs-12\"><hr></div></div></div>";

							$("#products").append(str);									
							});	
							i++;
							}
							else {
							$("#shoptips").text("亲，已经到底了，小熊已经通知掌柜的上新货了！");
							return false;
							}										
						}

						});
}
			});




	

	});
	</script>

<h4 class="tips">入驻商家</h4>
				
<div id="shops">
<% if(shops && shops.length>0){shops.forEach(function(shop,index){%>
	<div class="shop row clearfix">
		<div class="col-md-4 column">
		
					<div class="thumbnail">
						<%if(shop.shoppic){%>
						<img alt="300x200" src=<%=shop.shoppic%> />
						<%}else{%>
						<img alt="300x200" src="/images/show3.jpg" />
						<%}%>
						<div class="caption">
							<h3><a href="/shop/<%=shop.name%>">
								<%=shop.shopname%></a>
							</h3>
							<p>
								简介：<%if(shop.shopdesp){%><%=shop.shopdesp%><%}else{%>店主很懒，什么都没留下<%}%>
							</p>
							<p>
								店主：<%=shop.name%>
							</p>
							<p>
								关注：<%=shop.pv%>
							</p>
						</div>
					</div>
				</div>
				
		</div>
	</div>
	<%})}%>
</div>
<span id="shoptips" class="tips"></span>
<%- include shopfooter%>